package com.lizonghui.googleplay.base;

import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/6/19.
 * BaseAdapt的抽取
 */
public class MyBaseAdapter<ITEMBEANTYPE> extends BaseAdapter {
    public List<ITEMBEANTYPE> mDataSet = new ArrayList<>();

    //运用泛型来定义itembean的类型
    public MyBaseAdapter(List<ITEMBEANTYPE> datas) {
        mDataSet = datas;
    }


    @Override
    public int getCount() {
        if (mDataSet != null) {
            return mDataSet.size()+1;//这里+1是因为，我们在原来的count基础上，加多了一个加载更多的视图，使得总数多了1.
                                    //不+1这个，就滑不到加载更多的position
        }
        return 0;
    }

    @Override
    public Object getItem(int position) {
        if (mDataSet != null) {
            return mDataSet.get(position);
        }
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        return null;
    }


}

